package src;

import java.util.Random;

public class ConbatText {
    public static void main(String[] args) {
        //引入编写好的类
        // 创建两个角色
        Conbat r1 = new Conbat("宿舍长大人", 100 , '男');
        Conbat r2 = new Conbat("黑奴先生", 100,'女');
        Random r = new Random();
        int a = r.nextInt(2);
        //设定打架内容

        if (a == 0) {
            System.out.println(r1.getName()+"不讲五的");
            while (true) {
                r1.attr(r2);
                if (r2.getBlood() == 0) {
                    System.out.println(r1.getName() + "获得胜利");
                    break;
                }
                r2.attr(r1);
                if (r1.getBlood() == 0) {
                    System.out.println(r2.getName() + "获得胜利");
                    break;
                }
            }
        } else {
            System.out.println(r2.getName()+"不讲五的");
            while (true) {
                r2.attr(r1);
                if (r1.getBlood() == 0) {
                    System.out.println(r2.getName() + "获得胜利");
                    break;
                }
                r1.attr(r2);
                if (r2.getBlood() == 0) {
                    System.out.println(r1.getName() + "获得胜利");
                    break;
                }
            }
        }
    }
}
